﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.DBM;
using KPIS.GERP.GBMS.DAL;
using KPIS.GERP.GBMS.MODEL;
using KPIS.GERP.GBMS.DALFactory;
using KPIS.GERP.GBMS.IBLL;
using System.Globalization;
namespace KPIS.GERP.GBMS.BLL
{
    public class ProjectInformationBLL
    {
        DBManager dbManager;
        public ProjectInformationBLL()
        {

        }
        public void Insert()
        {

        }
        public void Update()
        {

        }
        public void Delete()
        {

        }

        public DataSet GetDataProjectInfomationForGrid(int Year)
        {
            DataSet ds = new DataSet();
            dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
            dbManager.Open();
            dbManager.CreateParameters(1);
            dbManager.AddParameters(0, "Year", Year);
            string StrSql = " select r.bgm_req_code as Code, r.bgm_req_name as ProName, s.bgm_strat_list_name as Strategy, j.job_site_name as JobSite " +
                            " , COALESCE(( select sum( price * coalesce( qty, 1 ) ) from bgm_request_expense e where e.bgm_req_seq = r.bgm_req_seq  ),0) as Budget,'' as Responsible " +
                            " from bgm_request r " +
                            " inner join bgm_strategy_data_list s on r.bgm_strat_list_seq = s.bgm_strat_list_seq " +
                            " inner join hrm_mp_job_sites j on r.job_site_seq = j.job_site_seq " +
                            " inner join hrm_ps_employees e on e.emp_seq = r.bgm_req_manager " +
                            " where r.bgm_year = @Year";
            ds = dbManager.ExecuteDataSet(CommandType.Text, StrSql);
            return ds;
        }
    }
}
